package com.xx.file.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xx.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import com.xx.file.mapper.AppFileMapper;
import com.xx.file.domain.AppFile;
import com.xx.file.service.IAppFileService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 附件Service业务层处理
 *
 * @author anqi
 * @date 2024-06-29
 */
@Service
public class AppFileServiceImpl extends ServiceImpl<AppFileMapper, AppFile> implements IAppFileService {

    @Autowired
    private AppFileMapper appFileMapper;

    /**
     * 查询附件
     *
     * @param id 附件主键
     * @return 附件
     */
    @Override
    public AppFile selectAppFileById(Long id) {
        return appFileMapper.selectAppFileById(id);
    }

    /**
     * 查询附件列表
     *
     * @param appFile 附件
     * @return 附件
     */
    @Override
    public List<AppFile> selectAppFileList(AppFile appFile) {
        return appFileMapper.selectAppFileList(appFile);
    }

    /**
     * 新增附件
     *
     * @param appFile 附件
     * @return 结果
     */
    @Override
    public int insertAppFile(AppFile appFile) {
        appFile.setCreateTime(DateUtils.getNowDate());
        return appFileMapper.insertAppFile(appFile);
    }

    /**
     * 修改附件
     *
     * @param appFile 附件
     * @return 结果
     */
    @Override
    public int updateAppFile(AppFile appFile) {
        appFile.setUpdateTime(DateUtils.getNowDate());
        return appFileMapper.updateAppFile(appFile);
    }

    /**
     * 批量删除附件
     *
     * @param ids 需要删除的附件主键
     * @return 结果
     */
    @Override
    public int deleteAppFileByIds(Long[] ids) {
        return appFileMapper.deleteAppFileByIds(ids);
    }

    /**
     * 删除附件信息
     *
     * @param id 附件主键
     * @return 结果
     */
    @Override
    public int deleteAppFileById(Long id) {
        return appFileMapper.deleteAppFileById(id);
    }

}
